/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@NONE}}.java.hbs
 */
package cn.ibizlab.core.system.domain;

import java.util.*;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.*;
import org.springframework.data.annotation.*;
import cn.ibizlab.util.annotation.*;
import cn.ibizlab.util.enums.*;
import cn.ibizlab.util.domain.IEntity;
import cn.ibizlab.util.domain.EntityBase;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.*;
import cn.ibizlab.core.system.domain.SysComponentApi;
import cn.ibizlab.core.system.domain.SysMenuFunc;
import cn.ibizlab.core.system.domain.SysPermission;

/**
 * 组件实体类[SysComponent]
 *
 * @author generator
 */
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(value = "handler")
@ApiModel(value = "SYS_COMPONENT", description = "组件")
public class SysComponent extends EntityBase implements Serializable
{

    /**
     * 标识
     */
    @Id
    @DEField(name = "id" , isKeyField = true)
    @JsonProperty("id")
    @JSONField(name = "id")
    @ApiModelProperty(value = "id", notes = "标识")
    private String id;

    /**
     * 代码名
     */
    @DEField(name = "code_name")
    @JsonProperty("code_name")
    @JSONField(name = "code_name")
    @ApiModelProperty(value = "code_name", notes = "代码名")
    private String codeName;

    /**
     * 显示名
     */
    @DEField(name = "display_name")
    @JsonProperty("display_name")
    @JSONField(name = "display_name")
    @ApiModelProperty(value = "display_name", notes = "显示名")
    private String displayName;

    /**
     * 组件类型
     */
    @DEField(name = "component_type")
    @JsonProperty("component_type")
    @JSONField(name = "component_type")
    @ApiModelProperty(value = "component_type", notes = "组件类型")
    private String componentType;

    /**
     * 上级组件标识
     */
    @DEField(name = "parent_id")
    @JsonProperty("parent_id")
    @JSONField(name = "parent_id")
    @ApiModelProperty(value = "parent_id", notes = "上级组件标识")
    private String parentId;

    /**
     * 路由
     */
    @DEField(name = "router_path")
    @JsonProperty("router_path")
    @JSONField(name = "router_path")
    @ApiModelProperty(value = "router_path", notes = "路由")
    private String routerPath;

    /**
     * 排序
     */
    @DEField(name = "sort")
    @JsonProperty("sort")
    @JSONField(name = "sort")
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "sort", notes = "排序")
    private Long sort;

    /**
     * 描述
     */
    @DEField(name = "description")
    @JsonProperty("description")
    @JSONField(name = "description")
    @ApiModelProperty(value = "description", notes = "描述")
    private String description;

    /**
     * 下级组件
     */
    @DEField(name = "children")
    @JsonProperty("children")
    @JSONField(name = "children")
    @ApiModelProperty(value = "children", notes = "下级组件")
    private List<SysComponent> children;

    /**
     * 接口
     */
    @DEField(name = "apis")
    @JsonProperty("apis")
    @JSONField(name = "apis")
    @ApiModelProperty(value = "apis", notes = "接口")
    private List<SysComponentApi> apis;

    /**
     * 组件
     */
    @JSONField(name = "parent")
    @JsonProperty("parent")
    @ApiModelProperty(value = "parent", notes = "上级组件")
    private SysComponent parent;


    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param includeEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T pasteTo(T targetEntity, boolean includeEmpty) {
        super.pasteTo(targetEntity, includeEmpty);
        if(targetEntity instanceof IEntity) {
            IEntity entity = ((IEntity) targetEntity);
            entity.reset("id");
        }
        return targetEntity;
    }

}